<?php	require_once(dirname(__FILE__).'/inc/config.inc.php');
if ( $_SESSION['adminlevel']>1  &&   $_SESSION['is_wage']=='0' && $_SESSION['check_wage']=='0'   ){
	echo "你没有权限";
	exit();
}

//初始化参数
$tbname = '#@__wage';
$gourl="";


//添加友情链接
if($action == 'add')
{
	$creat_time=time();
	$wage_month=strtotime($wage_month);
	
	$sql = "INSERT INTO `$tbname` (uid,zhiwu_wage, dixin_wage, zhusu_wage, jiadang_wage, weisheng_wage,gongling_wage,yewu_wage,dianhua_wage, tuandui_wage,bukuan_wage,bukuan_summary,quanqin_wage,ticheng_wage,yanglao_wage,	yiliao_wage,gongshang_wage,f_kaoqin_wage,f_yanglao_wage,f_yiliao_wage,f_gongjijin_wage,f_qita_wage,f_qita_summary,checkinfo,creat_time,wage_month) VALUES ('$uid', '$zhiwu_wage','$dixin_wage','$zhusu_wage','$jiadang_wage','$weisheng_wage','$gongling_wage','$yewu_wage','$dianhua_wage','$tuandui_wage','$bukuan_wage','$bukuan_summary','$quanqin_wage','$ticheng_wage','$yanglao_wage','$yiliao_wage','$gongshang_wage','$f_kaoqin_wage','$f_yanglao_wage','$f_yiliao_wage','$f_gongjijin_wage','$f_qita_wage','$f_qita_summary','false','$creat_time','$wage_month');";
	if($dosql->ExecNoneQuery($sql))
	{
		$errno=array('errno'=>0);
		$errmsg=array('errmsg'=>'ok');
		$json_json=array_merge($errno,$errmsg);
		$data=json_encode($json_json);
		echo $data;
	}
}


//修改友情链接
else if($action == 'update')
{
	$creat_time=time();
	$wage_month=strtotime($wage_month);
	$sql = "UPDATE `$tbname` SET zhiwu_wage='$zhiwu_wage', dixin_wage='$dixin_wage', zhusu_wage='$zhusu_wage', jiadang_wage='$jiadang_wage', weisheng_wage='$weisheng_wage',gongling_wage='$gongling_wage',yewu_wage='$yewu_wage',dianhua_wage='$dianhua_wage', tuandui_wage='$tuandui_wage',bukuan_wage='$bukuan_wage',bukuan_summary='$bukuan_summary',quanqin_wage='$quanqin_wage',ticheng_wage='$ticheng_wage',yanglao_wage='$yanglao_wage',	yiliao_wage='$yiliao_wage',gongshang_wage='$gongshang_wage',f_kaoqin_wage='$f_kaoqin_wage',f_yanglao_wage='$f_yanglao_wage',f_yiliao_wage='$f_yiliao_wage',f_gongjijin_wage='$f_gongjijin_wage',f_qita_wage='$f_qita_wage',f_qita_summary='$f_qita_summary',checkinfo='false',creat_time='$creat_time',wage_month='$wage_month' WHERE id=$id";
	if($dosql->ExecNoneQuery($sql))
	{
		$errno=array('errno'=>0);
		$errmsg=array('errmsg'=>'ok');
		$json_json=array_merge($errno,$errmsg);
		$data=json_encode($json_json);
		echo $data;
	}
}

//修改友情链接
else if($action == 'delM')
{


	$sql = "UPDATE `$tbname` SET is_delete='1' WHERE id=$id";
	if($dosql->ExecNoneQuery($sql))
	{
		$errno=array('errno'=>0);
		$errmsg=array('errmsg'=>'ok');
		$json_json=array_merge($errno,$errmsg);
		$data=json_encode($json_json);
		echo $data;
	}
}


//修改友情链接
else if($action == 'check')
{

	if ( $_SESSION['adminlevel']>1 && $_SESSION['check_wage']=='0' ){
		echo "你没有权限";
		exit();
	}
	
	if($checkinfo=='0'){
		$checkinfo_val=1;
	}
	if($checkinfo=='1'){
		$checkinfo_val=0;
	}

	$sql = "UPDATE `$tbname` SET checkinfo='$checkinfo_val' WHERE id='$id' ";
	//echo $sql;
	if($dosql->ExecNoneQuery($sql))
	{
		$errno=array('errno'=>0);
		$errmsg=array('errmsg'=>'ok');
		$json_json=array_merge($errno,$errmsg);
		$data=json_encode($json_json);
		echo $data;
	}
}



//无条件返回
else
{
	header("location:$gourl");
	exit();
}
?>
